package com.platform.event.core;

import java.util.Date;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.w3c.dom.events.EventException;

import com.platform.event.core.contants.EventConstants;
import com.platform.event.core.enums.EventStatusEnum;
import com.platform.event.core.model.BaseEvent;
import com.platform.event.core.model.EventResult;
import com.platform.task.core.impl.ThreadPoolTaskSchedulerComponent;

public class EventBus {
	private static Logger logger = LoggerFactory.getLogger(EventBus.class);

	@Resource
	protected ThreadPoolTaskSchedulerComponent threadPoolTaskSchedulerComponent;

	@Autowired
	protected EventService eventService;

	@Autowired
	private EventHandleHelper eventHandlerHelper;

	/**
	 * 发送事件<br>
	 * TODO 暂时一个事件只允许有一个处理器，以后考虑多处理器. <br>
	 * 暂时没有考虑data数据较大时，会占用大量内存.<br>
	 * 
	 * @param event
	 * @return
	 */
	public EventResult publish(BaseEvent event) {
		return eventService.saveEvent(event);
	}

}
